//1、导入 router 包
import VueRouter from 'vue-router'

// 导入组件
import HomeContainer from "../components/tabbar/HomeContainer.vue"
import MemberContainer from "../components/tabbar/MemberContainer.vue"
import SearchContainer from "../components/tabbar/SearchContainer.vue"
import ShopContainer from "../components/tabbar/ShopContainer.vue"
import NewsList from "../components/news/NewsList.vue"
import NewsInfo from "../components/news/NewsInfo.vue"
import PhotoList from "../components/photos/photolist.vue"
import PhotoInfo from "../components/photos/photoInfo.vue"

// 商品列表
import GoodList from "../components/goods/GoodList.vue"
import GoodsInfo from "../components/goods/goodsInfo.vue"
import GoodsDesc from "../components/goods/GoodsDesc.vue"
import GoodsComment from "../components/goods/GoodsComment.vue"

//2、创建路由对象
var router = new VueRouter({
    routes: [
        { path: '/', redirect: '/home' },//重定向
        { path: '/home', component: HomeContainer },
        { path: '/menber', component: MemberContainer },
        { path: '/search', component: SearchContainer },
        { path: '/shopcar', component: ShopContainer },
        { path: '/home/newslist', component: NewsList },
        { path: '/home/newinfo/:id', component: NewsInfo },
        { path: '/home/photolist', component: PhotoList },
        { path: '/home/photoinfo/:id', component: PhotoInfo },
        { path: '/home/goodslist', component: GoodList },
        { path: '/home/goodsinfo/:id', component: GoodsInfo },
        { path: '/home/goodsdesc/:id', component: GoodsDesc, name: 'goodsdesc' },
        { path: '/home/goodscomment/:id', component: GoodsComment, name: 'goodscomment' }
    ],
    linkActiveClass: 'mui-active' //覆盖默认路由高亮的类
})

// 3、把路由对象暴露出去
export default router